package com.diandian.backend.log.param;

import com.diandian.base.boot.starter.exception.DefaultException;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.diandian.backend.log.dto.LogTaskAddParamDTO;

import java.io.Serializable;
import java.util.Date;

public class LogTaskAddParam implements Serializable {

	private String belong;
	private String businessType;
	private String businessId;
	private String taskName;
	@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
	private Date expectedEndTime;
	private String remark;
	private String createUserId;
	private String createUserName;
	@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
	private Date createTime;

	public void check(){
		if(this.belong == null || "".equals(this.belong)){
			throw new DefaultException("归属标识不能为空");
		}
		if(this.businessType == null || "".equals(this.businessType)){
			throw new DefaultException("业务类型不能为空");
		}
		if(this.businessId == null || "".equals(this.businessId)){
			throw new DefaultException("业务id不能为空");
		}
		if(this.taskName == null || "".equals(this.taskName)){
			throw new DefaultException("任务名称不能为空");
		}
	}

	public LogTaskAddParamDTO toDTO(){
		LogTaskAddParamDTO dto = new LogTaskAddParamDTO();
		dto.setBelong(this.belong);
		dto.setBusinessType(this.businessType);
		dto.setBusinessId(this.businessId);
		dto.setTaskName(this.taskName);
		dto.setExpectedEndTime(this.expectedEndTime);
		dto.setRemark(this.remark);
		dto.setCreateUserId(this.createUserId);
		dto.setCreateUserName(this.createUserName);
		dto.setCreateTime(this.createTime);
		return dto;
	}

	public String getBelong() {
		return belong;
	}
	public String setBelong(String belong) {
		return this.belong = belong;
	}
	public String getBusinessType() {
		return businessType;
	}
	public String setBusinessType(String businessType) {
		return this.businessType = businessType;
	}
	public String getBusinessId() {
		return businessId;
	}
	public String setBusinessId(String businessId) {
		return this.businessId = businessId;
	}
	public String getTaskName() {
		return taskName;
	}
	public String setTaskName(String taskName) {
		return this.taskName = taskName;
	}
	public Date getExpectedEndTime() {
		return expectedEndTime;
	}
	public Date setExpectedEndTime(Date expectedEndTime) {
		return this.expectedEndTime = expectedEndTime;
	}
	public String getRemark() {
		return remark;
	}
	public String setRemark(String remark) {
		return this.remark = remark;
	}
	public String getCreateUserId() {
		return createUserId;
	}
	public String setCreateUserId(String createUserId) {
		return this.createUserId = createUserId;
	}
	public String getCreateUserName() {
		return createUserName;
	}
	public String setCreateUserName(String createUserName) {
		return this.createUserName = createUserName;
	}
	public Date getCreateTime() {
		return createTime;
	}
	public Date setCreateTime(Date createTime) {
		return this.createTime = createTime;
	}
}
